<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9">
<title>View Student Courses</title>
</head>
<style type="text/css">
th {text-align: right}
</style>
<body>

<?php include '../../top.html'; ?>
<?php include '../../security/ui/Authorization.php' ?>
<?php
	//include '../../security/ui/Authorization.php';
	//authorize(4);
	session_start();
	$studentID = $_SESSION['uname'];
	$year = $_SESSION['year'];
	$semester = $_SESSION['semester'];

	$semesterName = $_SESSION['semesterName'];
?>

<p>
<?php
	echo "<center><h1>Course Details</h1></center>";
	
	require_once '../../commonutils/db/DBConnectionManager.php';

	$sqlquery = "select s.courseCode as courseCode, s.sectionNumber as sectionid,  c.courseName as courseName from enrollment as e,  section as s, course as c where e.studentID = ".$studentID.
	" and e.semesterID=".$year.$semester." and e.semesterID = s.semesterID and e.sectionID=s.sectionID and s.courseCode=c.courseCode ";
	
	//echo $sqlquery;
	$result = DBConnectionManager::query($sqlquery) or die("No registered courses yet");
	if(mysql_num_rows($result) == 0)
	{
		echo "<br><center><h4>No registered courses for year ".$year." semester ".$semesterName.".</h4></center><br><br>";
	}
	else
	{
	
		echo "<center><table border=\"1\" width=\"71%\" id=\"table1\">";
		echo "<tr>";
		echo "<td width=\"95\">Course Code</td>";
		echo "<td width=\"65\">Section</td>";

		echo "<td width=\"224\">Course Name</td>";
		echo "</tr>";
	
		while($row = mysql_fetch_assoc($result))
		{
			echo "<td width=\"95\">".$row['courseCode']."</td>";
			echo "<td width=\"65\">".$row['sectionid']."</td>";

			echo "<td width=\"224\">".$row['courseName']."</td>";
			echo "</tr>";
		}
		echo "</table>";
		echo "</center>";
	}	
?>
</p>  

<br>
<hr color="blue">
<p>
<a href="../../StudentIndex.php"> Back </a>
</p>

</body>

</html>
